﻿Imports System
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports System.Security.Permissions

Namespace System.Workflow.Runtime.Tracking
    <Serializable> _
    Public NotInheritable Class TrackingProfileDeserializationException
        Inherits SystemException
        ' Methods
        Public Sub New()
            Me._args = New List([Of] ValidationEventArgs)
        End Sub

        Public Sub New(ByVal message As String)
            MyBase.New(message)
            Me._args = New List([Of] ValidationEventArgs)
        End Sub

        Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
            MyBase.New(info, context)
            Me._args = New List([Of] ValidationEventArgs)
            If (info Is Nothing) Then
                Throw New ArgumentNullException("info")
            End If
            Me._args = DirectCast(info.GetValue("__TrackingProfileDeserializationException_args__", GetType(List([Of] ValidationEventArgs))), List([Of] ValidationEventArgs))
        End Sub

        Public Sub New(ByVal message As String, ByVal innerException As Exception)
            MyBase.New(message, innerException)
            Me._args = New List([Of] ValidationEventArgs)
        End Sub

        <SecurityPermission(SecurityAction.Demand, SerializationFormatter:=True)> _
        Public Overrides Sub GetObjectData(ByVal info As SerializationInfo, ByVal context As StreamingContext)
            If (info Is Nothing) Then
                Throw New ArgumentNullException("info")
            End If
            MyBase.GetObjectData(info, context)
            info.AddValue("__TrackingProfileDeserializationException_args__", Me._args)
        End Sub


        ' Properties
        Public ReadOnly Property ValidationEventArgs As IList([Of] ValidationEventArgs)
            Get
                Return Me._args
            End Get
        End Property


        ' Fields
        Private _args As List([Of] ValidationEventArgs)
    End Class
End Namespace

